package sjtu.rfid.rri.services.binding;

import java.util.List;
import java.util.Properties;

public interface BindingService {

	/**
	 * bind the service according to specified properties.
	 * 
	 * @param service
	 *            the service needed to be bound
	 * @param properties
	 *            the key-value (Each one is a service binding) of the service
	 * @return the ServiceEndpoint
	 * @throws BindingTypeNotFoundException
	 *             if the binding type specified in properties can't be found.
	 * @throws BindingException
	 *             if failed to bind the service.
	 */
	List<ServiceEndpoint> bindingService(Object service, Properties properties)
			throws BindingTypeNotFoundException, BindingException;

	/**
	 * return a binded reference according to specified properties.
	 * 
	 * @param serviceEndpointInterface
	 *            Service endpoint interface of the reference.
	 * @param properties
	 *            the key-value (Each one is a reference) of the reference
	 * @return the binded reference
	 * @throws BindingTypeNotFoundException
	 *             if the binding type specified in properties can't be found.
	 * @throws BindingException
	 *             if failed to bind the reference.
	 */
	<T> T bindingReference(Class<T> serviceEndpointInterface,
			Properties properties) throws BindingTypeNotFoundException,
			BindingException;

}
